import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import path from "path";
import configApi from "./config/env";
// import viteVueUnocss, { unocss, flex, border, sketch, pseudo } from './js_sdk/a-hua-unocss';

export default defineConfig(async () => {
  const UnoCss = await import("unocss/vite").then((i) => i.default);
  return {
    plugins: [
      uni(),
      UnoCss(),
      //      viteVueUnocss({
      //          /** 预设数组；默认[unocss()] */
      //          presets: [
      //              /**
      //               * 默认预设；
      //               * text-24、uno-text-24、xx-text-24...
      //               */
      //              unocss(),

      //              /**
      //               * 弹性盒速写；
      //               * flex-center、flex-col-center、flex-row-center...
      //               */
      //              flex(),
      // 	border(),
      // 	sketch(),
      // 	pseudo()
      //          ],
      // unit: 'rpx'
      //      })
    ],
    resolve: {
      alias: {
        "@": path.resolve(__dirname, "."),
        "@/pages": path.resolve(__dirname, "./pages"),
        "@/components": path.resolve(__dirname, "./components"),
        "@/static": path.resolve(__dirname, "./static"),
        "@/utils": path.resolve(__dirname, "./utils"),
        "@/api": path.resolve(__dirname, "./api"),
        "@/store": path.resolve(__dirname, "./store"),
        "@/common": path.resolve(__dirname, "./common"),
      },
    },
    define: {
      'process.env.config': configApi,// 配置全局的环境变量值
      'process.env': process.env,//
    },
  };
});
